from rest_framework import serializers

from apps.house.models import Area, House


class AreasSerializers(serializers.ModelSerializer):
    aid = serializers.IntegerField(source='id')
    aname = serializers.CharField(source='name')

    class Meta:
        model = Area
        fields = ['aid', 'aname']


class HouseSerializers(serializers.ModelSerializer):
    user = serializers.StringRelatedField(read_only=True)
    user_id = serializers.IntegerField()
    area = serializers.StringRelatedField(read_only=True)
    area_id = serializers.IntegerField()
    class Meta:
        model = House
        fields = "__all__"











